import { ElNotification, ElMessageBox, ElMessage } from 'element-plus'
// notify 通知
export function LsNotifyBox(notifyObj) {
  let defaultNotifyObj = {
    type: 'success',
    message: '操作成功',
    title: '',
    duration: 2000,
    customClass: 'custom'
  }
  let mixObj = Object.assign(defaultNotifyObj, notifyObj)
  mixObj.customClass = mixObj.customClass + '-notify'
  return ElNotification(mixObj)
}
// messageBox 确认框
export function LsMessageBox(msgObj) {
  let defaultMsgObj = {
    type: 'warning',
    message: '',
    isContact: true,
    title: '提示',
    customClass: 'common',
    showConfirmButton: true,
    showCancelButton: true,
    confirmButtonText: '确认',
    cancelButtonText: '取消',
    closeOnClickModal: true
  }
  let mixObj = Object.assign(defaultMsgObj, msgObj)
  console.log(mixObj)
  if (mixObj.isContact) {
    mixObj.message = '此操作将删除' + (mixObj.message || '该条数据') + '，是否继续？'
  }
  mixObj.customClass = mixObj.customClass + '-msgbox'
  return ElMessageBox(mixObj)
}
// message 消息提示框
export function RfMessage(msgObj) {
  let defaultMsgObj = {
    type: 'error',
    message: '',
    showClose: false,
    duration: 2000
  }
  const mixObj = Object.assign(defaultMsgObj, msgObj)
  return ElMessage(mixObj)
}
